package com.ithiema.read;

import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelReader;
import com.alibaba.excel.read.metadata.ReadSheet;
import com.ithiema.EmployeeListener.EmployeeListener;
import com.ithiema.dao.EmployeeDao;
import com.ithiema.pojo.Employee;
import com.ithiema.utils.TestFileUtil;
import org.junit.Test;

/*
    使用自定义监听器读数据
 */
public class MyRead {

    // 读单表
    @Test
    public void testRead(){
        String filename = TestFileUtil.getPath() + "3万.xlsx";
        ExcelReader reader = EasyExcel.read(filename, Employee.class,new EmployeeListener(new EmployeeDao())).build();
        ReadSheet sheet = EasyExcel.readSheet().build();
        reader.read(sheet);
    }

    @Test
    public void testRead3(){
        String filename = TestFileUtil.getPath() + "批量写数据1669108667435.xlsx";
        EasyExcel.read(filename, Employee.class, new EmployeeListener(new EmployeeDao())).sheet().doRead();
    }
}
